import React from 'react'

export default function ResultPage() {
    // 获取本地存储的历史分析结果
    const history = JSON.parse(localStorage.getItem('pifuresult_history') || '[]')
    
    
  return (
    <div style={{ padding: 16, background: '#f7f7fa', minHeight: '100vh', fontFamily: 'sans-serif' }}>
      <h2 style={{ fontWeight: 600, fontSize: 20, marginBottom: 16 }}>报告分数</h2>
      {history.length === 0 && <div style={{ color: '#aaa', textAlign: 'center' }}>暂无历史记录</div>}
      {history.map((item, idx) => (
        <div
          key={idx}
          style={{
            background: '#fff',
            borderRadius: 12,
            boxShadow: '0 2px 8px #eee',
            padding: 16,
            marginBottom: 16,
            display: 'flex',
            flexDirection: 'column',
            gap: 8,
          }}
        >
          <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
            <span style={{ fontWeight: 600, fontSize: 16, color: '#7356f1' }}>
              皮肤测试得分 {item.skin_score ? item.skin_score + '分' : '--'}
            </span>
            <span style={{ color: '#888', fontSize: 13 }}>
              {item.time ? new Date(item.time).toLocaleString() : ''}
            </span>
          </div>
          <div style={{ color: '#444', fontSize: 15, marginTop: 4 }}>
            {item.skin_content || '无分析结论'}
          </div>
        </div>
      ))}
    </div>
  )
}
